package org.example.config;

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;

import java.util.Objects;
import java.util.concurrent.TimeUnit;

public class CacheUtil {
    private static final Cache<String, String> caffeine ;
    static {
        caffeine = Caffeine.newBuilder()
                        .expireAfterWrite(30, TimeUnit.MINUTES)
                        .build();
    }
    private CacheUtil() {

    }

    public static Cache<String, String> getCache() {
        return caffeine;
    }

//    public static void main(String[] args) {
//        CacheUtil.getCache().put("1", "11");
//        CacheUtil.getCache().put("2", "22");
//        System.out.println(CacheUtil.getCache().get("2", x -> ""));
//    }

}
